﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SCADA_SANEST.Models
{
    public class PlcSignal : INotifyPropertyChanged
    {
        public string Name { get; set; }
        public string Address { get; set; }
        public PlcDataType Type { get; set; }

        private object _value;
        public object Value
        {
            get => _value;
            set
            {
                if (_value != value)
                {
                    _value = value;
                    OnPropertyChanged(nameof(Value));
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public enum PlcDataType
    {
        Bool,
        Int,
        Word,
        DInt,
        Real
    }
}
